package com.tjsinfo.tjsoa.mail.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.mail.bo.ITjsDeleteEmailBo;

public class DeleteDeleteEmailAction extends Action{
	private ITjsDeleteEmailBo tjsDeleteEmailBo;
	
	public ITjsDeleteEmailBo getTjsDeleteEmailBo() {
		return tjsDeleteEmailBo;
	}

	public void setTjsDeleteEmailBo(ITjsDeleteEmailBo tjsDeleteEmailBo) {
		this.tjsDeleteEmailBo = tjsDeleteEmailBo;
	}

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		try {
			tjsDeleteEmailBo.deleteEmailList(request.getParameterValues("checkbox2"));
			request.setAttribute("linkurl", "tjsinfo/tjsoa/mail/deleteEmaiList.do");
			request.setAttribute("message", "email.message.deleteemail");
			return mapping.findForward("success");
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return mapping.findForward("error");
		}
	}
	
}
